package com.jwsoft.manager.core.gateway.controller;

import com.jwsoft.manager.core.integration.EduDataTaskDetailIntegration;
import com.jwsoft.manager.common.vo.eduDataTaskDetail.EduDataTaskDetailVO;
import com.jwsoft.manager.common.vo.eduDataTaskDetail.EduDataTaskDetailKeyVO;
import com.jwsoft.manager.common.vo.eduDataTaskDetail.EduDataTaskDetailQueryVO;
import com.github.pagehelper.PageInfo;
import com.bifang.engine.assistant.core.domain.AppResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import com.bifang.engine.protect.core.annotation.Idempotent;
import org.springframework.validation.annotation.Validated;
import com.bifang.assistant.common.constants.Validators;

/**
 * 数据备份任务详情表网关
 *
 * @author zhiyuan
 * @since 2023-09-13
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "数据备份任务详情表", description = "数据备份任务详情表")
public class EduDataTaskDetailController {

    @Autowired
    public EduDataTaskDetailIntegration eduDataTaskDetailIntegration;

    @Operation(summary = "数据备份任务详情表分页查询",description = "数据备份任务详情表分页查询")
    @PostMapping(value = "/eduDataTaskDetail0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduDataTaskDetailVO>> getList(@RequestBody @Validated EduDataTaskDetailQueryVO vo) {
        return AppResponse.successData(eduDataTaskDetailIntegration.getList(vo));
    }

    @Operation(summary = "数据备份任务详情表根据主键查询详情",description = "数据备份任务详情表根据主键查询详情")
    @PostMapping(value = "/eduDataTaskDetail0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduDataTaskDetailVO> getById(@RequestBody @Validated EduDataTaskDetailKeyVO vo) {
        return AppResponse.successData(eduDataTaskDetailIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "数据备份任务详情表新增",description = "数据备份任务详情表新增")
    @PostMapping(value = "/eduDataTaskDetail0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduDataTaskDetailVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduDataTaskDetailVO vo) {
        return AppResponse.successData(eduDataTaskDetailIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "数据备份任务详情表修改",description = "数据备份任务详情表修改")
    @PostMapping(value = "/eduDataTaskDetail0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduDataTaskDetailVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduDataTaskDetailVO vo) {
        return AppResponse.successData(eduDataTaskDetailIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "数据备份任务详情表删除",description = "数据备份任务详情表删除")
    @PostMapping(value = "/eduDataTaskDetail0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduDataTaskDetailKeyVO vo) {
        eduDataTaskDetailIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "单业务数据迁移",description = "单业务数据迁移")
    @PostMapping(value = "/eduDataTaskDetail0007", produces = "application/json;charset=UTF-8")
    public AppResponse dataTaskMigration(@RequestBody @Validated EduDataTaskDetailQueryVO vo) {
        eduDataTaskDetailIntegration.dataTaskMigration(vo);
        return AppResponse.successMsg("迁移成功！");
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "单业务数据加密",description = "单业务数据加密")
    @PostMapping(value = "/eduDataTaskDetail0008", produces = "application/json;charset=UTF-8")
    public AppResponse dataTaskDetailEncrypt(@RequestBody @Validated EduDataTaskDetailQueryVO vo) {
        eduDataTaskDetailIntegration.dataTaskDetailEncrypt(vo);
        return AppResponse.successMsg("加密成功！");
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "单业务数据解密",description = "单业务数据解密到临时表")
    @PostMapping(value = "/eduDataTaskDetail0009", produces = "application/json;charset=UTF-8")
    public AppResponse dataTaskDetailDecrypt(@RequestBody @Validated EduDataTaskDetailQueryVO vo) {
        eduDataTaskDetailIntegration.dataTaskDetailDecrypt(vo);
        return AppResponse.successMsg("数据恢复成功！");
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "单业务数据核销",description = "单业务数据核销")
    @PostMapping(value = "/eduDataTaskDetail0010", produces = "application/json;charset=UTF-8")
    public AppResponse dataTaskDetailClean(@RequestBody @Validated EduDataTaskDetailQueryVO vo) {
        eduDataTaskDetailIntegration.dataTaskDetailClean(vo);
        return AppResponse.successMsg("数据核销成功！");
    }
}
